package cn.edu.swu.lms;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        ImageManager imageManager = new ImageManager();
        Scanner scanner = new Scanner(System.in);

        System.out.println("=== 图片下载系统 ===");
        System.out.println("图片存储路径: " + imageManager.getImageBasePath());
        System.out.println();

        while (true) {
            printMenu();
            System.out.print("请选择操作 (1-4): ");
            String choice = scanner.nextLine().trim();

            switch (choice) {
                case "1":
                    imageManager.downloadImage();
                    break;
                case "2":
                    imageManager.listImages();
                    break;
                case "3":
                    imageManager.searchImage();
                    break;
                case "4":
                    System.out.println("感谢使用图片下载系统，再见！");
                    scanner.close();
                    return;
                default:
                    System.out.println("无效选择，请重新输入！");
            }

            System.out.println(); // 空行分隔
        }
    }

    /**
     * 打印菜单
     */
    private static void printMenu() {
        System.out.println("1. 下载图片");
        System.out.println("2. 查看所有图片");
        System.out.println("3. 搜索图片");
        System.out.println("4. 退出");
    }
}

